package org.ztr.yanai.ai.controller.prompt;

import jakarta.annotation.Resource;
import org.springframework.ai.chat.model.ChatResponse;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.ztr.yanai.ai.service.PromptService;
import reactor.core.publisher.Flux;

/**
 * @Author: ZhaoTR
 * @Date: Created in 2025/10/30 20:51
 * @Description: 测试 Prompt（调用 Service）
 * @Version: 1.0
 */
@RestController
@RequestMapping("/ai")
public class PromptController {

    private final PromptService promptService;

    public PromptController(PromptService promptService) {
        this.promptService = promptService;
    }

    @GetMapping("/prompt/chat")
    public Flux<String> chat(@RequestParam String question) {
        return promptService.chatAsLegalAssistant(question);
    }

    @GetMapping("/prompt/chat2")
    public Flux<ChatResponse> chat2(@RequestParam String question) {
        return promptService.chatAsStoryTellerWithResponse(question);
    }

    @GetMapping("/prompt/chat3")
    public Flux<String> chat3(@RequestParam String question) {
        return promptService.chatAsHtmlStoryTeller(question);
    }

    @GetMapping("/prompt/chat4")
    public String chat4(@RequestParam String question) {
        return promptService.chatOnce(question);
    }

    @GetMapping("/prompt/chat5")
    public String chat5(@RequestParam String city) {
        return promptService.chatWithWeatherTool(city);
    }
}